<div>
    <fieldset>
        <legend><?php echo $this->FieldName(); ?></legend>

        <?php echo $this->RecSwitch()->ToHtml(); ?>

        <input type="hidden" id="field_id" value="<?php echo $this->data['field_id']; ?>"/>
        <input type="hidden" id="text_i" value="<?php echo $this->data['i']; ?>"/>

        <div class="PageMenu">Поиск <input class="Text" type="text" id="FindRec"/></div>
   </fieldset>

    <div class="ControlPanel">
        <button id="IsertWord"/>Вставить</button>
        <button id="CancelDict"/>Закрыть</button>
    </div>

    <script type="text/javascript">
        jsun.run(function() {

        jsun("#IsertWord").jsun.event({ onclick: IsertWord });
        jsun("#CancelDict").jsun.event({ onclick: CloseDict });
        jsun("#FindRec").jsun.event({ onkeyup: FindRec });

        var pref = "DictRec",
            param = "u=Lib&m=Lib\\Dict/RecPage&field_id=" + jsun("#field_id").value;
        jsun.swap[pref].Req = param;
        jsun.swap[pref].Start();

        function FindRec() {
            param = "u=Lib&m=Lib\\Dict/RecPage&field_id="
                + jsun("#field_id").value
                + "&rec=" + encodeURIComponent(jsun("#FindRec").value);
            jsun.swap[pref].Req = param;
            jsun.swap[pref].Page = 1;
            jsun.swap[pref].Start();
        }

        function IsertWord() {
            var word = jsun.swap[pref].Rec;
            if (word) jsun("#F_" + jsun("#text_i").value).value += word;
            return CloseDict();
        }

        function CloseDict() {
            return jsun.dialog.active.close();
        }

        });
    </script>
</div>